#include<bits/stdc++.h>
#define int long long
#define N 10000005
using namespace std;
int n,k;
int fac[N],inv[N];
int w[N];
int len,s[N],p[N];
int ans;
bool vis[N];
const int mod=998244353;
int Pow(int x,int y){
	x%=mod;
	int z=1;
	while(y){
		if(y&1) z=z*x%mod;
		x=x*x%mod;
		y>>=1;
	}
	return z;
}
void init(){
	fac[0]=inv[0]=1;
	for(int i=1;i<=n;i++) fac[i]=fac[i-1]*i%mod;
	inv[n]=Pow(fac[n],mod-2);
	for(int i=n-1;i>=1;i--) inv[i]=inv[i+1]*(i+1)%mod;
	w[0]=1;
	for(int i=1;i<=n;i++) w[i]=w[i-1]*n%mod;

	s[1]=1;
	for(int i=2;i<=n;i++){
		if(!vis[i]){
			p[++len]=i;
			s[i]=Pow(i,k);
		}
		for(int j=1;j<=len&&i*p[j]<=n;j++){
			vis[i*p[j]]=1;
			s[i*p[j]]=s[i]*s[p[j]]%mod;
			if(i%p[j]==0) break;
		}
	}
}
int C(int n,int m){
	if(n<0||m<0||n<m) return 0;
	return fac[n]*inv[m]%mod*inv[n-m]%mod;
}
signed main(){
	freopen("length.in","r",stdin);
	freopen("length.out","w",stdout);
	scanf("%lld %lld",&n,&k);
	init();
	for(int i=1;i<=n;i++){
		ans=(ans+C(n,i)*fac[i-1]%mod*w[n-i]%mod*s[i]%mod)%mod;
	}
	printf("%lld",ans);
	return 0;
}